Skip to content

Initial setup with REST v2 - #438

Merged
tpanajott merged 6 commits into
develfrom
rework_initial_setup
Nov 14, 2026
Merged

tpanajott merged 6 commits into
develfrom
rework_initial_setup

Conversation

@tpanajott

@tpanajott tpanajott commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Rework initial setup to use new REST v2 instead of the old setup as to not clear secrets (specifically) home assistant provided SUPSERVISOR_TOKEN when running as HA addon.

See issue #437 for more information.

@tpanajott tpanajott self-assigned this Nov 14, 2026
@tpanajott

Copy link
Copy Markdown
Collaborator Author

@jamesmulcahy I've rewritten the initial setup to use the new REST v2 settings API but there seems to be an issue around saving the theme that I can't quite wrap my head around. From what I can tell the "theme" parameter is configured exactly like, say, "manager_address" which works as expected. Any thoughts? I tried looking at the getValues("theme") just before saving and it reports back the theme I selected but it is not saved in the DB.

@jamesmulcahy

Copy link
Copy Markdown
Contributor

The theme isn't being saved because buildPatch only sends fields that are in dirtyFields, and setValue() doesn't mark a field dirty unless you pass shouldDirty (it's off by default because RHF can't tell a user action from code populating the form). manager_address works because its <input> goes through register(), and the onChange handler marks it dirty. In Step2_Theme:

setValue("theme", theme_option, { shouldDirty: true });

(same as step3_edit_light.tsx does). The other setValue calls on non-secret fields need it too: the auto-detected manager_address and the port button in Step 3, and mqtt_username in Step 4's "no auth" button. Without it those are silently dropped from the PATCH. Secrets are fine since buildPatch sends them based on their value. Alternatively, {...register("theme")} on the radio inputs would mark it dirty the same way the text fields do.

A couple of small things Claude spotted: main.css loses ~260 lines of classes (bg-red-600, animate-spin, …), which looks like a Tailwind build that didn't scan all the templates. The comment in form.ts still says the theme is edited elsewhere, and Step 7's text lost the word "contribute."

@tpanajott

Copy link
Copy Markdown
Collaborator Author

Ah, of course. Thanks! I'll try and get to it soon enough.

@tpanajott
tpanajott merged commit ddf5510 into devel Nov 14, 2026
9 checks passed
@tpanajott
tpanajott deleted the rework_initial_setup branch November 14, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants